﻿using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;

namespace Project.Domain.Base
{
    public abstract class BaseEntity
    {
        [BsonId] //标识主键
        //以允许将参数作为类型 string 而非 ObjectId 结构传递。 Mongo 处理从 string 到 ObjectId 的转换。
        [BsonRepresentation(BsonType.ObjectId)]
        public string Id { get; set; }


        /// <summary>
        /// 租户Id. 0表示宿主
        /// </summary>
        [Display(Name = "租户Id")]
        [Required]
        public string TenantId { get; set; } = "";

        [Display(Name = "添加时间")]
        [Required]
        public DateTime CreationTime { get; set; } = DateTime.Now;
    }
}
